package com.umeng.analytics.pro;

import android.content.Context;

import org.json.JSONObject;

public class bh implements az {
    private static final int a = 0;
    private static final int b = 1;
    private static final int c = 2;
    private static final int d = 3;
    private static final long e = 14400000;
    private static final long f = 28800000;
    private static final long g = 86400000;
    private int h;
    private final long i;
    private static bh j = null;

    private bh() {
        this.h = 0;
        this.i = 60000;
    }

    public static bh a(Context arg3) {
        bh v0_1;
        Class v1 = bh.class;
        synchronized (v1) {
            if (bh.j == null) {
                bh.j = new bh();
                bh.j.a(af.a(arg3).b().a(0));
            }
            v0_1 = bh.j;
        }
        return v0_1;
    }

    public void a(JSONObject arg5, Context arg6) {
        if (this.h == 1) {
            arg5.remove("error");
            arg5.remove("ekv");
            arg5.remove("gkv");
            arg5.remove("cc");
            w.a(arg6).a(false, true);
            m.a(arg6).b(new f());
            return;
        }

        if (this.h == 2) {
            arg5.remove("sessions");
            try {
                arg5.put("sessions", this.a());
            } catch (Exception v0) {
            }

            arg5.remove("error");
            arg5.remove("ekv");
            arg5.remove("gkv");
            arg5.remove("cc");
            w.a(arg6).a(false, true);
            m.a(arg6).b(new f());
            return;
        }

        if (this.h == 3) {
            arg5.remove("sessions");
            arg5.remove("error");
            arg5.remove("ekv");
            arg5.remove("gkv");
            arg5.remove("cc");
            w.a(arg6).a(false, true);
            m.a(arg6).b(new f());
        }
    }

    public void a(af.a arg2) {
        this.a(arg2.a(0));
    }

    public void a(int arg2) {
        if (arg2 >= 0 && arg2 <= 3) {
            this.h = arg2;
        }
    }

    public JSONObject a() {
        long v6 = 60000;
        JSONObject v0 = new JSONObject();
        try {
            long v2 = System.currentTimeMillis();
            v0.put("id", bd.a());
            v0.put("start_time", v2);
            v0.put("end_time", v2 + v6);
            v0.put("duration", 60000);
        } catch (Throwable v1) {
        }

        return v0;
    }

    public long b() {
        long v0;
        switch (this.h) {
            case 1: {
                v0 = 14400000;
                break;
            }
            case 2: {
                v0 = 28800000;
                break;
            }
            case 3: {
                v0 = 86400000;
                break;
            }
            default: {
                v0 = 0;
                break;
            }
        }

        return v0;
    }

    public long c() {
        long v0 = this.h == 0 ? 0 : 300000;
        return v0;
    }

    public boolean d() {
        boolean v0 = this.h != 0 ? true : false;
        return v0;
    }
}

